import { defineConfig } from "vite";
import { resolve } from "path";
import vue from "@vitejs/plugin-vue";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: [
      {
        find: "@",
        replacement: resolve(__dirname, "./src"),
      },
      {
        find: "assets",
        replacement: resolve(__dirname, "./src/assets"),
      },
    ],
    extensions: [".ts", ".js"],
  },
  css: {
    preprocessorOptions: {
      less: {
        modifyVars: {
          "arcoblue-6": "#5542F6",
          "primary-6": "#5542F6",
          "color-primary-6": "#5542F6",
          "border-radius-medium": "6px",
          "border-radius-small": "6px",
        },
        additionalData: '@import "@/theme/vars.less";',
        javascriptEnabled: true,
      },
    },
  },
  server: {
    // 配置服务器代理，实现跨域
    port: 3001,
    proxy: {
      "/reverie": {
        target: "http://localhost:8098/",
        changeOrigin: true,
      },
    },
  },
});
